package com.bindapp.adapter;

import android.content.Context;
import android.support.v4.content.ContextCompat;

import com.bindapp.R;
import com.bindapp.databinding.ItemDeviceDetailBinding;
import com.bindapp.listener.RecyclerItemClick;
import com.youth.banner.listener.OnBannerListener;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by apple on 2018/7/1.
 */

public class GridAdapter extends BaseRcAdapter {
    private Context context;
    private OnBannerListener click;
    private String txtImgStr = "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3266514659,532374305&fm=27&gp=0.jpg";
    private List<String> pathlist,titlelist;
    private Integer[] imglist=new Integer[]{R.drawable.imglabel1,R.drawable.imglabel2,R.drawable.imglabel3,R.drawable.imglabel4,R.drawable.imglabel5,R.drawable.imglabel6,R.drawable.imglabel6,R.drawable.imglabel8,R.drawable.imglabel9,R.drawable.imglabel10,R.drawable.imglabel11};
    private String[] titlabellist=new String[]{"水温","PH值","泡泡浴","泡泡景观","水处理","按摩1","按摩2","彩灯","进水","排水","耗材"};
    private String[] statelabellist=new String[]{"当前温度数值","当前酸碱度","工作模式","工作模式","工作模式","工作模式","工作模式","工作模式","进水温度","工作模式","清理周期"};
    private String[] valuelist=new String[]{"23°c","5","正常","正常","强力","正常","脉冲","自动","20°c","正常","20h","5"};

    public GridAdapter(Context context,List<Object> datas, int layoutId, int mVariableId, RecyclerItemClick listener,OnBannerListener click) {
        super(datas, layoutId, mVariableId, listener);
        pathlist=new ArrayList<String>();
        titlelist=new ArrayList<String>();
        this.context=context;
        this.click=click;
        for(int i=0;i<1;i++){
            pathlist.add(txtImgStr);
            titlelist.add("店铺商城：摄像头"+i);
        }
    }

    @Override
    public void BinderHolder(BaseHolder holder, int position) {
        if(holder instanceof ContentHolder){
            ((ItemDeviceDetailBinding)holder.getBinding()).typeimg.setImageDrawable(ContextCompat.getDrawable(context,imglist[position-1]));
            ((ItemDeviceDetailBinding)holder.getBinding()).imglabel.setText(titlabellist[position-1]);
            ((ItemDeviceDetailBinding)holder.getBinding()).statusTxt.setText(statelabellist[position-1]);
            ((ItemDeviceDetailBinding)holder.getBinding()).typevalue.setText(valuelist[position-1]);

            if(position%3==0){
                ((ItemDeviceDetailBinding)holder.getBinding()).switchbtn.setChecked(true);
            }else{
                ((ItemDeviceDetailBinding)holder.getBinding()).switchbtn.setChecked(false);
            }

        }else if(holder instanceof HeadHolder){
            /*Banner banner = ((ItemDeviceHeadBinding)holder.getBinding()).banner;
            banner.setIndicatorGravity(BannerConfig.LEFT);
            banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
            banner.setBannerAnimation(Transformer.Default);
            banner.setImages(pathlist);
            banner.setImageLoader(new GlideRoundImageLoader());
            banner.setBannerTitles(titlelist);
            banner.setDelayTime(2000);
            banner.setOnBannerListener(click);

            banner.isAutoPlay(true);
            banner.start();*/
        }

    }
}
